package org.dubnation.base.annotation;


import org.dubnation.base.excel.upload.util.SexJustManAndWomanImpl;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER }) //范围
@Retention(RetentionPolicy.RUNTIME) // 运行时
@Repeatable(SexJustManAndWoman.List.class)
@Documented
@Constraint(validatedBy = {SexJustManAndWomanImpl.class}) // 指明自定义注解的实现类
public @interface SexJustManAndWoman {

    String message() default "sex just can be man and woman";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    String man() default "1";
    String woman() default "0";

    @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
    @Retention(RUNTIME)
    @Documented
    @interface List {
        SexJustManAndWoman[] value();
    }
}
